home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c++-part2 / 10722 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.4 KB

  1. Path: inforamp.net!ts6-06
  2. From: rmorin@inforamp.net (Randy Charles Morin)
  3. Newsgroups: comp.lang.c++
  4. Subject: Re: How to append data in visual c++
  5. Date: Sat, 09 Mar 96 19:55:44 GMT
  6. Organization: MiddleWorld SoftWare
  7. Message-ID: <4hsnod$rsm@sam.inforamp.net>
  8. References: <4hk4g6$afg@ustsu10.ust.hk>
  9. NNTP-Posting-Host: ts6-06.tor.inforamp.net
  10. X-Newsreader: News Xpress Version 1.0 Beta #4
  11.  
  12. In article <4hk4g6$afg@ustsu10.ust.hk>,
  13.    ee_twh@uxmail.ust.hk (Tsang Wai Hung) wrote:
  14. >  I am now doing videoconferencing. When I receive a pointer through
  15. >network which contain binary data, I want to append it to another pointer.
  16. >These two pointers belong to LPSTR. How can I append it? Is there
  17. >any function like strcat and strcpy but for binary data?
  18.  
  19. I'm not sure what you mean, but if you mean that you have two LPSTR's and want 
  20. to concatenate them, then the first solution applies.  If you have two LPSTR's 
  21. and know for certain they are binary and are aware of the length, then the 
  22. second solution applies.  If LPSTR is not the same as the windows type, then 
  23. please completely ignore my suggestions.
  24.  
  25. #1
  26. Try the following...
  27.  
  28.     LPSTR a,b;
  29.     lstrcat(a,b);
  30.  
  31. ..this appends b to the end of a.
  32. lstrcat is part of the standard windows API.
  33.  
  34. #2
  35. Try the following...
  36.  
  37.     LPSTR a,b;
  38.     int aLength, bLength;
  39.     memcpy(a+aLength,b,bLength);
  40.     aLength+=bLength;
  41.  
  42. ..this appends b to the end of a.
  43. memcpy is part of the standard library.
  44.  
  45.